using System;
using System.Windows.Forms;

namespace VirtualPostcard
{
#if WINDOWS || XBOX
    static class Program
    {
     
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            if (Settings.Default.OptInRuntimeIntelligence == 0)
            {
                OptInOrNot();
            }
            using (VirtualPostcard game = new VirtualPostcard())
            {
                game.Run();
            }
        }

        public static bool GetOptInRuntimeIntelligenceStatus()
        {
            return Settings.Default.OptInRuntimeIntelligence == 1;
        }

        public static void OptInOrNot()
        {
            DialogResult result = MessageBox.Show(
@"Developers need you !

In order to improve the application and give feedback to the development team, the application can gather anonymous data about your usage of """ + Application.ProductName + @""".

Do you want to enable this feature ?
- Yes (recommended), you can opt-out at anytime by pressing Shift-R in the application
- No, you can opt-in at anytime by pressing Shift-R in the application
- Cancel if you don't want to decide now",
            "Usage statistics", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
            switch (result)
            {
                case DialogResult.Yes:
                    Settings.Default.OptInRuntimeIntelligence = 1;
                    break;
                case DialogResult.No:
                    Settings.Default.OptInRuntimeIntelligence = -1;
                    break;
                case DialogResult.Cancel:
                    Settings.Default.OptInRuntimeIntelligence = 0;
                    break;
            }
            Settings.Default.Save();
        }
    }
#endif
}

